const Koa = require('koa');

const app = new Koa();

const router = require('koa-router')();

const bodyparser = require('./middleware/bodyparser');

app.use(bodyparser());

app.use(router.routes());

app.use(router.allowedMethods());

router.get('/api/list',async ctx => {
    ctx.body = 'list'
})

router.post('/api/add',async (ctx) => {
    console.log("===",ctx.request.body);
    ctx.body = 'add';
})

app.listen(3000,() => {
    console.log("服务器启动成功")
})

